<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>${sysName}</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="${resRoot}/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="${resRoot}/css/main.css" media="all" />
	<link rel="stylesheet" href="${resRoot}/layui/admin/admin.css" media="all" />
</head>
<body class="childrenBody">
	<div class="layui-fluid">   
          <div class="layui-card">
	<div class="layui-form layui-card-header layuiadmin-card-header-auto">
	<form id="searchForm" class="layui-form layui-form-pane" method="post" action=""  >
	<div class="layui-inline">
		    <label class="layui-form-label">申办编号</label>
		    <div class="layui-input-block">
		    <input type="text" name="sbbh" id="sbbh" autocomplete="off"  placeholder="请输入申办编号" class="layui-input">
		    </div>
    	</div>
    	<div class="layui-inline">
		    <label class="layui-form-label">项目名称</label>
		    <div class="layui-input-block">
		    <input type="text" name="xmmc" id="xmmc" autocomplete="off"  placeholder="请输入项目名称" class="layui-input">
		    </div>
    	</div>
    	<div class="layui-inline">
		    <label class="layui-form-label">申请人</label>
		    <div class="layui-input-block">
		    <input type="text" name="sqr" id="sqr" autocomplete="off"  placeholder="请输入申请人" class="layui-input">
		    </div>
    	</div>
    	<div class="layui-inline">
		    <label class="layui-form-label">残疾人证号</label>
		    <div class="layui-input-block">
		    <input type="text" name="cjrzh" id="cjrzh" autocomplete="off"  placeholder="请输入残疾人证号" class="layui-input">
		    </div>
    	</div>
    	<div class="layui-inline">
		    <label class="layui-form-label">证件号码</label>
		    <div class="layui-input-block">
		    <input type="text" name="zjhm" id="zjhm" autocomplete="off"  placeholder="请输入证件号码" class="layui-input">
		    </div>
    	</div>
    	<div class="layui-inline">
		    <label class="layui-form-label">事项名称</label>
		    <div class="layui-input-block">
		    <input type="text" name="sxmc" id="sxmc" autocomplete="off"  placeholder="请输入事项名称" class="layui-input">
		    </div>
    	</div>
    	<div class="layui-inline">
		    <label class="layui-form-label">办结跟踪</label>
		    <div class="layui-input-block">
		    <input type="text" name="bjgz" id="bjgz" autocomplete="off"  placeholder="请输入办结跟踪" class="layui-input">
		    </div>
    	</div>
    	<div class="layui-inline">
		    <label class="layui-form-label">受理日期</label>
		
		       <div class="layui-input-block" >
		            <input type="text" name="slrq" id="slrq" onClick="WdatePicker({slrq:'%y-%M-%d 23:59',dateFmt:'yyyy-MM-dd HH:mm',alwaysUseStartDate:true,lang:'zh-cn'});"  value="<#if slrq?? >${slrq!}</#if>"  autocomplete="off" placeholder="请输入采集时间" class="layui-input">
		         </div>
    	</div>
    	<div class="layui-inline">
		    <label class="layui-form-label">承诺日期</label>
		
		       <div class="layui-input-block" >
		            <input type="text" name="cnrq" id="cnrq" onClick="WdatePicker({cnrq:'%y-%M-%d 23:59',dateFmt:'yyyy-MM-dd HH:mm',alwaysUseStartDate:true,lang:'zh-cn'});"  value="<#if cnrq?? >${cnrq!}</#if>"  autocomplete="off" placeholder="请输入采集时间" class="layui-input">
		         </div>
    	</div>
    	<div class="layui-inline">
		    <label class="layui-form-label">办结日期</label>
		 
		    
		       <div class="layui-input-block" >
		            <input type="text" name="bjrq" id="bjrq" onClick="WdatePicker({bjrq:'%y-%M-%d 23:59',dateFmt:'yyyy-MM-dd HH:mm',alwaysUseStartDate:true,lang:'zh-cn'});"  value="<#if bjrq?? >${bjrq!}</#if>"  autocomplete="off" placeholder="请输入采集时间" class="layui-input">
		         </div>
    	</div>
    	
		<div class="layui-inline">
		    <button class="layui-btn search_btn" id=""  lay-submit="" lay-filter="searchDataBtn"  type="button">查询</button>
		</div>
		<div class="layui-inline">
			<a class="layui-btn linksAdd_btn" style="background-color:#5FB878" href="javascript:void(0);" onclick="openWin('${base}/sys/clZwfwZwfwsx/input',null,'添加');">添加</a>
			<a class="layui-btn linksAdd_btn" href="javascript:void(0);" onclick="exportExcel();">导出</a>
			
			<@shiro.hasPermission name="clZwfwZwfwsx:import">
			<a class="layui-btn linksAdd_btn" href="javascript:void(0);" onclick="importExcel();">导入</a>
		</@shiro.hasPermission>
		</div>
		</form>
	<div class="layui-form member_list" style="margin-top: 10px;" >
	  	
	  	<table class="layui-hide" id="test" lay-filter="demo" ></table>
		<script type="text/html" id="barDemo">
		  <a class="layui-btn layui-btn-xs" lay-event="detail">查看</a>

		</script>
	</div>
	</div>
	</div></div>
	<#include "/page/footer.html">
	<script>
	
	$(function(){
		});
	
	var table;
	layui.use(['table', 'form'], function(){
		form = layui.form,
	  table = layui.table;
	  
	  table =  $.extend(table, {config: {checkName: 'checked'}});
	  table.render({
	    elem: '#test'
	    // 头部栏取消导出事件 'exports'
	    ,defaultToolbar: ['filter', 'print']
	    ,toolbar: '#toolbarDemo' //开启头部工具栏，并为其绑定左侧模板
	    ,url:'${base}/sys/clZwfwZwfwsx/getPageData'
	    ,where:{
	    	
	    }
	    ,cols: [[
	    // 默认不开启合计，需要使用时自行开启合计功能， 并在render添加参数 totalRow: true  例如url:'https://www.layui.com/doc/modules/table.html#options'，在需要开启合计的行中添加 totalRow: true
	    // {type:'checkbox', fixed: true, disabled:true,totalRowText: '合计', checkbox:false},
	    { type: 'numbers', title: '序号', width: 80, fixed: 'left' },
			{field:'sbbh', width:120, title: '申办编号',},
			{field:'xmmc', width:120, title: '项目名称',},
			{field:'sqr', width:120, title: '申请人',},
			{field:'cjrzh', width:120, title: '残疾人证号',},
			{field:'zjhm', width:120, title: '证件号码',},
			{field:'sxmc', width:120, title: '事项名称',},
			{field:'bjgz', width:120, title: '办结跟踪',},
			{field:'slrq', width:120, title: '受理日期',},
			{field:'cnrq', width:120, title: '承诺日期',},
			{field:'bjrq', width:120, title: '办结日期',},
	      {fixed: 'right', width: 190, align:'center',title: '操作', toolbar: '#barDemo'}
	    ]]
	    ,loading:true
	    ,page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
		      layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
		      //,curr: 5 //设定初始在第 5 页
		      ,groups: 5 //只显示 5 个连续页码
		      ,first: "首页" //显示首页
		      ,last: "尾页" //显示尾页
	}
	      ,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据
	    	  console.log(res)
	        return {
	          "code": res.message.code, //解析接口状态
	          "msg": res.message.msg, //解析提示文本
	          "count": res.message.count, //解析数据长度
	          "data": res.message.data //解析数据列表
	        };
	      }
	  });
	  
	      
	      var reloadTable = function (data) {
	          table.reload("test", { //此处是上文提到的 初始化标识id
	              where: data
	              ,page: { 
			      layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
			      ,groups: 5 //只显示 5 个连续页码
			      ,first: "首页" //显示首页
			      ,last: "尾页" //显示尾页
				}
	          });
	      };

	  
	//监听表格复选框选择
	  table.on('checkbox(demo)', function(obj){
		  console.log(obj.data)
	  });
	  
	  form.on('submit(searchDataBtn)', function(data){
			reloadTable(data.field)
	    });
	  
	  //监听工具条
	  table.on('tool(demo)', function(obj){
	    var data = obj.data;
	    if(obj.event === 'detail'){
	      var url = "${base}/sys/clZwfwZwfwsx/detial";
	      openWin(url,data.id,'查看详情');
	    } else if(obj.event === 'del'){
	        del(data.id);
	    } else if(obj.event === 'edit'){
	    	var url = "${base}/sys/clZwfwZwfwsx/input";
	        openWin(url,data.id,'修改详情');
	    } 
	  });
	});
	
	document.onkeydown = function (event) {
        var e = event || window.event;
        if (e && e.keyCode == 13) { //回车键的键值为13
        	$(".search_btn").click(); //调用登录按钮的登录事件
        }
    }; 
	function exportExcel() {
		var index = layer.msg('加载中...',{icon: 16,time:false,shade:0.8});
		$("#searchForm").attr("action","${base}/sys/clZwfwZwfwsx/export");
		$("#searchForm").submit();
		layer.close(index);
	}
	
	  		function del(id){	
	  			layer.confirm('确定删除该条数据吗?', function(index){
  				 $.ajax({
  		    		 type : "post",
  		    		 url : "${base}/sys/clZwfwZwfwsx/del",
  		    		 data : {
  		    			  id : id
  		    			 },
  					 dataType : "json",
  					 async : false,
  					 success : function(data) {
  						 flag  = data.message;
  							if(flag != 0) {
  								layer.msg('删除成功！', {
  									  icon: 1,
  									  time: 2000 //2秒关闭（如果不配置，默认是3秒）
  									}, function(){
  									  //do something
  										window.location.reload();
  									});  

  								
  							} else {
  								layer.alert("数据错误，请完善数据！");
  							}
  					 }
  		    	 });
  			});
		}
	  		
	  		function importExcel() {
	  			var url = "${base}/sys/clZwfwZwfwsx/toImport";
	  			var titleStr = "数据导入";
	  	        var index = layui.layer.open({
	  	            title : titleStr,
	  	            type : 2,
	  	            content : url,
	  	            success : function(layero, index){
	  	                var body = layui.layer.getChildFrame('body', index);
	  	                setTimeout(function(){
	  	                    layui.layer.tips('点击此处返回', '.layui-layer-setwin .layui-layer-close', {
	  	                        tips: 3
	  	                    });
	  	                },500)
	  	            }
	  	        })
	  	        layui.layer.full(index);
	  	        //改变窗口大小时，重置弹窗的宽高，防止超出可视区域（如F12调出debug的操作）
	  	        $(window).on("resize",function(){
	  	            layui.layer.full(index);
	  	        })
	  		}

			function showPhoto(url) {
			var jsonstr = "{'title':'','id':123,'start':0,'data':[{'alt':'图1','pid':666,'src':'" + url +"','thumb':''}]}";
			var json = eval('(' + jsonstr + ')');
			layer.photos({
			photos: json
			,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机（请注意，3.0之前的版本用shift参数）
			});
			}
	  		
</script>
</body>
</html>